-module(erlapi_route).

-export([get/0]).

-include_lib("ehttp/include/ehttpd.hrl").


%%%===================================================================
%%% API functions
%%%===================================================================

get() ->
    [
        get_auth()
    ].


%%%===================================================================
%%% Internal functions
%%%===================================================================

get_auth() ->
    ?EH_GROUP("/v1", [
        ?EH_GROUP("/auth", [
            ?EH_POST("/login", {api_auth, login})
            ,?EH_POST("/logout", {api_auth, logout})
            ,?EH_POST("/login_token", {api_auth, login_token}, middle_auth)
        ])
        ,?EH_GROUP("/adm_users", [
            ?EH_GET("", {api_adm_user, get_all})
            ,?EH_POST("", {api_adm_user, add})
            ,?EH_PUT(":id", {api_adm_user, edit})
            ,?EH_DELETE(":id", {api_adm_user, delete})

            ,?EH_PATCH(":id/reset", {api_adm_user, reset})
            ,?EH_PATCH("password", {api_adm_user, password})
        ])
    ]).
